package prog1.common;

import prog1.serialization.SerializerType;

/**
 * Created with IntelliJ IDEA.
 * User: Roi
 * Date: 07/12/13
 *
 * Program definitions
 */
public class Defs {

    // Parameters filename
    public static final String PARAMETERS_FILENAME = "Parameters";

    // Parameters serialization method
    public static final SerializerType SERIALIZER_TYPE = SerializerType.TEXT;

    // Block size definition
    public static final short BLOCK_SIZE = 8;

    // Buffer size definition
    public static final short BUFFER_SIZE = 1024;

    /**
     * Defaults:
     *
     * 1. All algorithms and service providers are declared as constants in order
     *    to support easy change.
     *
     * 2. Key Store type was set to be "JCEKS" which is provided by "SunJCE":
     *    * This key store type has much stronger encryption than jks ("SUN"), for instance.
     *    * This key store type allows storing both symmetric key (for AES)
     *      and also public/private keys (for RSA/DSA).
     *
     * 3. AES algorithm with CBC mode was chosen following the instructions,
     *    service provider "SunJCE" was chosen since support it supports
     *    algorithms based on symmetric keys (AES is not implemented by "SUN")
     *
     * 4. SHA1withDSA algorithm was chosen for signature since it is asymmetric as
     *    in the requirements. "SUN" was chosen since it's not provided by
     *    "SunJCE".
     *
     * 5. RSA algorithm was chosen for key encryption following the instructions,
     *    "SunJCE" was chosen as service provider since it is not available in
     *    "SUN".
     */
    public static class Defaults {
        public static final String KEY_STORE_TYPE = "JCEKS";
        public static final String KEY_STORE_PROVIDER = "SunJCE";
        public static final String KEY_STORE_FILE_NAME = "KeyStore.jck";

        public static final short IV_SIZE_IN_BYTES = 16;

        public static final String FILE_ENCRYPTION_ALGORITHM = "AES";
        public static final String FILE_ENCRYPTION_PROVIDER = "SunJCE";

        public static final String KEY_ENCRYPTION_ALGORITHM = "RSA";
        public static final String KEY_ENCRYPTION_PROVIDER = "SunJCE";

        public static final String FILE_ENCRYPTION_TRANSFORMATION = "AES/CBC/PKCS5Padding";

        public static final String KEY_STORE_SIGNATURE_ALGORITHM_ALIAS = "DSA_KEY";
        public static final String KEY_STORE_KEY_ENCRYPTION_ALGORITHM_ALIAS = "RSA_KEY";

        public static final String SIGNATURE_ALGORITHM = "SHA1withDSA";
        public static final String SIGNATURE_PROVIDER = "SUN";

        public static final String INPUT_FILENAME = "Input_File.txt";
        public static final String ENCRYPTED_FILENAME = "Encrypted_File.txt";
        public static final String DECRYPTED_FILENAME = "Decrypted_File.txt";
    }
}
